package com.example.mapp;

import com.example.entity.AfterDo;
import org.apache.ibatis.annotations.*;

/**
 * Created by simon on 2018/12/4.
 */
@Mapper
public interface AfterDoMapp {

    @Select(" select * from after_do where event_type = #{eventType} and status=#{status}")
    AfterDo findByType(AfterDo afterDo) throws Exception;

    @Delete(" delete from after_do where id = #{id}")
    int deleteById(String id) throws Exception;

    @Update(" update after_do set event_type=#{eventType},event_action=#{eventAction}," +
            " thing=#{thing},status=#{status}," +
            " start_dt=#{startDt}, end_dt=#{endDt} where id=#{id}")
    int update(AfterDo adviceNote) throws Exception;

    @Insert(" insert into after_do " +
            " (event_type,event_action,thing,status, start_dt, end_dt, ext1, ext2, ext3) " +
            "value " +
            "(#{eventType},#{eventAction},#{thing}, #{status},#{startDt},#{endDt},#{ext1},#{ext2},#{ext3})")
    @SelectKey(statement="select last_insert_id()",keyProperty = "id",keyColumn = "id",before = false,resultType = Long.class)
    int insert(AfterDo afterDo) throws Exception;

}
